diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index ed2163b..5e5887d 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -12,5 +12,10 @@ jobs: - uses: actions/setup-node@v2 with: node-version: '10' - - run: npm install + - run: yarn install + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: yarn run specs_without_eslint + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OPENSSL_CONF: /dev/null diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..37838e2 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN} +@invoca:registry=https://npm.pkg.github.com diff --git a/README.md b/README.md index b811a20..8917921 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Written as a plugin-based framework, where the DataTables integration is a plugi ## Install ``` -npm install backdraft-app +npm install @invoca/backdraft-app ``` ## Usage @@ -15,7 +15,7 @@ First, define a new Backdraft app: // app.js import MainRouter from "./main_router"; -import App from "backdraft-app/src/app"; +import App from "@invoca/backdraft-app/src/app"; class TableExample extends App { activate($el) { @@ -40,7 +40,7 @@ Define the various components of your app: // main_router.js import IndexView from "./views/index_view"; -import Router from "backdraft-app/src/router"; +import Router from "@invoca/backdraft-app/src/router"; export default class MainRouter extends Router { get routes() { @@ -56,7 +56,7 @@ export default class MainRouter extends Router { }; // models/book.js -import Model from "backdraft-app/src/model"; +import Model from "@invoca/backdraft-app/src/model"; export default class Book extends Model { }; @@ -64,7 +64,7 @@ export default class Book extends Model { // collections/books.js import Book from "../models/book"; -import Collection from "backdraft-app/src/collection"; +import Collection from "@invoca/backdraft-app/src/collection"; export default class Books extends Collection { get model() { @@ -75,20 +75,20 @@ export default class Books extends Collection { // views/book_table_view.js import BookRowView from "./book_row_view"; -import LocalDataTable from "backdraft-app/src/data_table/local_data_table"; +import LocalDataTable from "@invoca/backdraft-app/src/data_table/local_data_table"; export default class BookTableView extends LocalDataTable { get rowClass() { return BookRowView; } - + get paginate() { return false; } }; // views/book_row_view.js -import Row from "backdraft-app/src/data_table/row"; +import Row from "@invoca/backdraft-app/src/data_table/row"; export default class BookRowView extends Row { get columns() { @@ -108,21 +108,21 @@ Now create the view that pulls all the pieces together: import BookTableView from "./book_table_view"; import Books from "../collections/books"; -import View from "backdraft-app/src/view"; +import View from "@invoca/backdraft-app/src/view"; export default class IndexView extends View { render() { const collection = new Books(); const data = []; - + // fake data for (let iter = 0; iter < 10; ++iter) { data.push({ name : `Book ${iter + 1}` }); } - + collection.add(data); const table = new BookTableView({ collection }); - + this.$el.html(table.render().$el); return this; } @@ -149,7 +149,7 @@ Finally, in an HTML page that loads the above scripts, activate the app at load ## Legacy Usage The legacy usage uses the `Backdraft` object to define the components of the application. - + First, define a new Backdraft app and what plugins it will use: ```javascript @@ -293,14 +293,14 @@ Run the yarn `dev` script from the main directory to have the source and test fi Run the `specs` script to run all the tests and exit yarn run specs - + Use the following two ENV variables to target specific tests: - `SPEC_FILTER` - target specific tests via [karma-jasmine's --grep feature](https://github.com/karma-runner/karma-jasmine/blob/4f70e5e77831998dc252b2f7ad1353398144588b/README.md#configuration). - + - `SPEC_FILE_FILTER` - target specific tests by file path. This value must be a regex. For example: - `SPEC_FILE_FILTER="/data_table.*_spec.js/" yarn run specs` + `SPEC_FILE_FILTER="/data_table.*_spec.js/" yarn run specs` See all available commands with: @@ -317,7 +317,23 @@ Thank you to all [the contributors](https://github.com/invoca/backdraft/contribu ### Publishing - admins -To publish a new version to NPM (https://www.npmjs.com/package/backdraft-app), do the following +`@invoca/backdraft-app` is published to the Invoca GitHub Packages npm registry: + +https://github.com/Invoca/backdraft/pkgs/npm/backdraft-app + +To publish a new version to the Invoca GitHub Packages npm registry, do the following: + +#### One-time setup + +Add a GitHub personal access token with `write:packages` scope to your shell environment (e.g. `~/.zshrc` or `~/.bashrc`): + +```sh +export GITHUB_TOKEN= +``` + +Create a token at https://github.com/settings/tokens. + +#### Publishing 1. Ensure the following are complete: * Tested @@ -328,7 +344,7 @@ To publish a new version to NPM (https://www.npmjs.com/package/backdraft-app), d * creates commit with version change * tags the commit with the version * pushes the commit and tag to Github - * builds and publishes the node module + * publishes the package to GitHub packages 3. If on a branch, ensure this version gets **merged to master** diff --git a/package.json b/package.json index 0a828ef..bbc766e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "backdraft-app", + "name": "@invoca/backdraft-app", "version": "1.3.8", "description": "Plugin-based UI application framework built on top of and extending Backbone to create single page apps", "files": [ @@ -13,7 +13,7 @@ "specs_without_eslint": "karma start --single-run", "dev": "yarn run eslint; karma start", "examples": "grunt examples", - "postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\"" + "postversion": "git push --tags && npm publish && git push && echo \"Successfully released version $npm_package_version!\"" }, "author": "Invoca", "license": "MIT",