mirror of
https://github.com/aleleba/create-node-ts-graphql-server.git
synced 2025-01-09 05:26:50 -06:00
PR-598592: Updating package and adding CI and fixing cli.bin
This commit is contained in:
parent
a7f4cd0511
commit
6ffd0f6032
30
.github/workflows/npm-publish.yml
vendored
Normal file
30
.github/workflows/npm-publish.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
name: NPM testing and publish package
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm ci
|
||||
- run: npm test
|
||||
|
||||
publish-npm:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm ci
|
||||
- run: npm publish --access=public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
33
.github/workflows/npm-test.yml
vendored
Normal file
33
.github/workflows/npm-test.yml
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
name: Testing package
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ['*']
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js 16
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
cache: 'npm'
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm ci
|
||||
- run: npm test
|
||||
test-build-package:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm ci
|
||||
- run: npm run build
|
15
bin/cli.js
15
bin/cli.js
@ -13,7 +13,11 @@ const runCommand = command => {
|
||||
|
||||
const repoName = process.argv[2];
|
||||
const gitCheckoutCommand = `git clone --depth 1 https://github.com/aleleba/create-node-ts-graphql-server ${repoName}`;
|
||||
const installDepsCommand = `cd ${repoName} && rm -rf .git && git init && git add . && git commit -m "Initial commit" && npm install --legacy-peer-deps`;
|
||||
const installDepsCommand = `cd ${repoName} && npm install --legacy-peer-deps`;
|
||||
const cleanGitHistoryCommand = `cd ${repoName} && rm -rf .git && git init && git add --all -- ":!.github" ":!bin" && git commit -m "Initial commit"`
|
||||
const cleanGitHistoryCommandWindows = `cd ${repoName} && rmdir .git /s /q && git init && git add --all -- ":!.github" ":!bin" && git commit -m "Initial commit"`
|
||||
const deleteFoldersCommand = `cd ${repoName} && rm -rf .github && rm -rf bin`
|
||||
const deleteFoldersCommandWindows = `cd ${repoName} && rmdir .github /s /q && rmdir bin /s /q`
|
||||
|
||||
console.log(`Cloning the repository with name ${repoName}`);
|
||||
const checkedOut = runCommand(gitCheckoutCommand);
|
||||
@ -23,7 +27,14 @@ console.log(`Installing dependencies for ${repoName}`);
|
||||
const installedDeps = runCommand(installDepsCommand);
|
||||
if(!installedDeps) process.exit(-1);
|
||||
|
||||
console.log(`Cleaning History of Git for ${repoName}`);
|
||||
const cleanGitHistory = isWin ? runCommand(cleanGitHistoryCommandWindows) : runCommand(cleanGitHistoryCommand);
|
||||
if(!cleanGitHistory) process.exit(-1);
|
||||
|
||||
console.log("Congratulations! You are ready. Follow the following commands to start");
|
||||
console.log(`cd ${repoName}`);
|
||||
console.log('Create a .env file with ENV=development(defauld: production), PORT=4000 (default: 4000), WHITELIST_URLS=your_url(default: http://localhost), GRAPHIQL=true(default: false)');
|
||||
console.log(`Then you can run: npm start:dev`);
|
||||
console.log(`Then you can run: npm start:dev`);
|
||||
|
||||
const deleteFolders = isWin ? runCommand(deleteFoldersCommandWindows) : runCommand(deleteFoldersCommand);
|
||||
if(!deleteFolders) process.exit(-1);
|
908
package-lock.json
generated
908
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@aleleba/create-node-ts-graphql-server",
|
||||
"version": "1.0.17",
|
||||
"version": "1.1.0",
|
||||
"description": "Node with Typescript and GraphQL Server",
|
||||
"bin": "./bin/cli.js",
|
||||
"main": "index.js",
|
||||
@ -32,7 +32,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/aleleba/node-ts-graphql-server#readme",
|
||||
"dependencies": {
|
||||
"@graphql-tools/schema": "^8.5.0",
|
||||
"@graphql-tools/schema": "^8.5.1",
|
||||
"body-parser": "^1.20.0",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"cors": "^2.8.5",
|
||||
@ -42,26 +42,26 @@
|
||||
"graphql": "^16.5.0",
|
||||
"graphql-playground-middleware-express": "^1.7.23",
|
||||
"graphql-subscriptions": "^2.0.0",
|
||||
"graphql-tools": "^8.3.0",
|
||||
"graphql-tools": "^8.3.1",
|
||||
"graphql-ws": "^5.9.1",
|
||||
"web-push": "^3.5.0",
|
||||
"ws": "^8.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.18.9",
|
||||
"@babel/preset-env": "^7.18.9",
|
||||
"@babel/core": "^7.18.10",
|
||||
"@babel/preset-env": "^7.18.10",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@babel/register": "^7.18.9",
|
||||
"@types/jest": "^28.1.6",
|
||||
"@types/node": "^18.6.1",
|
||||
"@types/node": "^18.6.3",
|
||||
"@types/webpack": "^5.28.0",
|
||||
"@types/webpack-node-externals": "^2.5.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
||||
"@typescript-eslint/parser": "^5.31.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.32.0",
|
||||
"@typescript-eslint/parser": "^5.32.0",
|
||||
"babel-loader": "^8.2.5",
|
||||
"clean-webpack-plugin": "^4.0.0",
|
||||
"compression-webpack-plugin": "^10.0.0",
|
||||
"eslint": "^8.20.0",
|
||||
"eslint": "^8.21.0",
|
||||
"eslint-webpack-plugin": "^3.2.0",
|
||||
"jest": "^28.1.3",
|
||||
"nodemon": "^2.0.19",
|
||||
|
Loading…
Reference in New Issue
Block a user