diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1533f32 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ +name: Publish Package to npmjs +on: + release: + types: [published] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: '18.x' + registry-url: 'https://registry.npmjs.org' + - run: npm ci + # TODO: Add back in after linting issues have been resolved. + # - run: npm lint + - run: npm version ${{ github.event.release.tag_name }} --no-git-tag-version + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/pcsync.js b/bin/pcsync.js similarity index 90% rename from pcsync.js rename to bin/pcsync.js index 824b116..8956de8 100755 --- a/pcsync.js +++ b/bin/pcsync.js @@ -1,10 +1,10 @@ #!/usr/bin/env node -const OverwriteAllLocalWithRemote = require('./src/sync-commands/overwrite-all-local-with-remote'); -const OverwriteAllRemoteWithLocal = require('./src/sync-commands/overwrite-all-remote-with-local'); -const CUtils = require('./src/utils/common-utils'); -const SyncUtils = require('./src/sync-commands/sync-utils'); -const SCUtils = require('./src/sync-commands/sync-command-utils'); +const OverwriteAllLocalWithRemote = require('../src/sync-commands/overwrite-all-local-with-remote'); +const OverwriteAllRemoteWithLocal = require('../src/sync-commands/overwrite-all-remote-with-local'); +const CUtils = require('../src/utils/common-utils'); +const SyncUtils = require('../src/sync-commands/sync-utils'); +const SCUtils = require('../src/sync-commands/sync-command-utils'); const program = require('commander'); diff --git a/pcwatch.js b/bin/pcwatch.js similarity index 80% rename from pcwatch.js rename to bin/pcwatch.js index 75b5aed..0f0ff94 100755 --- a/pcwatch.js +++ b/bin/pcwatch.js @@ -1,15 +1,15 @@ #!/usr/bin/env node -const GetConfig = require('./src/utils/get-config'); +const GetConfig = require('../src/utils/get-config'); const program = require('commander'); -const CUtils = require('./src/utils/common-utils'); -const WatchUtils = require('./src/watch-actions/watch-utils'); -const ActionCreated = require('./src/watch-actions/action-created'); -const SyncUtils = require('./src/sync-commands/sync-utils'); -const LocalWatcher = require('./src/utils/local-watcher'); -const CacheUtils = require('./src/utils/cache-utils'); -const LocalTraversal = require('./src/utils/local-traversal'); +const CUtils = require('../src/utils/common-utils'); +const WatchUtils = require('../src/watch-actions/watch-utils'); +const ActionCreated = require('../src/watch-actions/action-created'); +const SyncUtils = require('../src/sync-commands/sync-utils'); +const LocalWatcher = require('../src/utils/local-watcher'); +const CacheUtils = require('../src/utils/cache-utils'); +const LocalTraversal = require('../src/utils/local-traversal'); program.option('-f, --force', 'skip local/remote equality check'); diff --git a/package-lock.json b/package-lock.json index e87071d..54e059d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,8 +19,8 @@ "request-promise-native": "^1.0.9" }, "bin": { - "pcsync": "pcsync.js", - "pcwatch": "pcwatch.js" + "pcsync": "bin/pcsync.js", + "pcwatch": "bin/pcwatch.js" }, "devDependencies": { "@playcanvas/eslint-config": "^1.2.0", diff --git a/package.json b/package.json index 356c456..b43099a 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,11 @@ "sync", "local" ], + "files": [ + "bin", + "docs", + "src" + ], "license": "MIT", "main": "index.js", "bugs": { @@ -36,10 +41,10 @@ "eslint": "^8.24.0" }, "scripts": { - "lint": "eslint --ext .js,.mjs src pcsync.js pcwatch.js" + "lint": "eslint --ext .js,.mjs src bin" }, "bin": { - "pcsync": "./pcsync.js", - "pcwatch": "./pcwatch.js" + "pcsync": "./bin/pcsync.js", + "pcwatch": "./bin/pcwatch.js" } }