Commit Graph

19 Commits

Author SHA1 Message Date
Michael Bradley, Jr f10e0258cb build: introduce a `prepare` script in embark's package.json
**TL;DR**

These changes affect workflow with yarn. To prevent embark's `prepare` script
from running undesirably:

- If node_modules is in place and you're reinstalling after switching branches:

```
yarn run install_all
```

- If node_modules is missing (fresh clone or deleted):

```
EMBARK_NO_PREPARE=t yarn install && yarn run install_all
```

It's not recommended to set `EMBARK_NO_PREPARE` in your environment (e.g. in
`.bashrc`) since that would interfere with embark's `release` script if/when
you run it.

-----------------

**1.** Specify embark's build-related steps in the `prepare` script of
  package.json.

When embark is installed directly from GitHub the `prepare` script results in a
"pre install" phase (handled automatically by npm/yarn) that fetches
devDependencies, builds embark (including embark-ui), packs a tarball with the
same steps (minus testing and tree-checking) as would happen during an embark
release, and finally does a production install from that tarball.

Important point: installs from GitHub must be performed with yarn; they're no
longer possible with npm since during the "pre install" phase npm will honor
embark's `.npmrc` and `"engines"` settings.

The following will work correctly after this commit is merged:

```
yarn [global] add git+https://github.com/embark-framework/embark.git
```

Use of "hosted git" shortcuts (e.g. `embark-framework/embark#bracnh`) won't
work correctly because yarn doesn't fully support them. See:
https://github.com/yarnpkg/yarn/issues/5235.

It's important to use `git+https` urls. Following a succesful install with
`git+https` it is possible to use a "hosted git" shortcut or `https` url, but
that's owing to a subtle and unreliable interaction between yarn's cache and
yarn's logic for installing from a url/shortcut.

**2.** Adjust the npm configs (`.npmrc`) for embark/-ui so that `yarn run [cmd]
  [--opt]` can be used in place of `npm run [cmd] -- [--opt]`.

Either way is okay for running scripts, they're equivalent, but note the
requirement to use `--` before specifying command options with `npm run`.

**3.** Introduce yarn configs (`.yarnrc`) for embark/-ui and include the
  `check-files` directive.

H/t to @alaibe for the recommendation.

**4.** Ignore embark's `dist/typings` and `scripts` directories when packing a
  tarball.

**5.** Refactor embark/-ui's npm-scripts in relation to the `prepare` script,
  and make other small improvements.

Notably, if the environment variable `EMBARK_NO_PREPARE` is truthy (from JS
perspective) then embark's `prepare` script will exit early. This prevents
`install_all` and `prepare` from getting stuck in a loop (`install:core` uses
cross-env to set `EMBARK_NO_PREPARE`) and provides a mechanism for users to
skip the `prepare` script when doing a fresh install:

```
EMBARK_NO_PREPARE=t yarn install
```

**6.** Give `.js` extensions to node scripts in embark's `scripts/`, remove the
  shebang lines, and have npm-scripts explicitly invoke them with node.

This arrangement works for all platforms: Linux, macOS, and Windows.

**7.** Adjust travis and appveyor configs.

Since at present there aren't any tests or other CI steps that make use of
embark-ui's production build, set `EMBARK_NO_PREPARE` in the CI environments
and invoke `build:node` directly.

Check the working tree after `yarn install` for embark/-ui. This detects
situations where changes should have been committed to `yarn.lock` but were
not. Check the working tree again at the end to detect situations where ignore
files should have been adjusted but were not. Both checks could also detect
other surprising behavior that needs to be investigated. Any time the working
tree is not clean (there are untracked files or changes) CI will fail.

Drop CI runs for node 8.11.3 because that version ships with an older npm that
results in unstaged changes to the test apps' `package-lock.json` files,
causing the working tree check to fail at the end of the CI run. A simple
workaround isn't apparent, but the matter can be revisited.

**8.** Refactor embark's `release` script in light of the `prepare` script.

Notably, do the push step only after `npm publish` completes successfully. This
allows embark's `prepare` and `prepublishOnly` scripts to detect problems
before a commit and tag are pushed to GitHub, avoiding a need to rebase/revert
the remote release branch; the local branch will still need to have a commit
dropped and tag deleted before rerunning the `release` script.

Prompt the user if the `release` script is not being run in `--dry-run` mode.

Provide additional visual indicators of `--dry-run` mode.

Force the user to supply `--repo-branch [branch]` if the intention is to
release from a branch other than `master`.
2018-12-03 16:24:10 -06:00
Michael Bradley, Jr a3392e8279 hotfix: remove yarn cache clean for CI 2018-11-27 15:21:52 -06:00
Michael Bradley, Jr 885d07483e hotfix: yarn cache clean for CI 2018-11-27 14:48:30 -06:00
Jonathan Rainville 36da5a340e remove cache from yarn to fix malicious install 2018-11-27 10:48:08 -05:00
Michael Bradley, Jr 53191447f5 build: use yarn for reproducible builds and CI
yarn.lock files are generated for embark and embark-ui, and their package.json
files and other npm related files are updated to support and require using yarn
for development of embark itself and for embark's CI.
2018-11-20 09:25:42 -06:00
Michael Bradley, Jr 69dd8c5b89 build(packaging): reorg sources for transpilation with Babel
Allow for embark sources to be authored in TypeScript and/or JavaScript, and to
make use of upcoming features of the JS language. Sources in the src/ directory
are transpiled into the dist/ directory, and npm-scripts are provided to
support and automate various aspect of the build process. Source map support is
enabled at runtime, i.e. when invoking the embark cli and running embark's test
suite.
2018-11-11 15:08:55 -06:00
Iuri Matias da9880a9d2
Merge pull request #892 from embark-framework/features/travis-node-current
test node current release (10) in addition to node LTS release (8)
2018-09-21 18:28:15 -04:00
Iuri Matias 6db81f012a
Merge pull request #887 from embark-framework/features/travis-osx
configure travis to test on both Linux and macOS
2018-09-21 18:27:18 -04:00
Michael Bradley, Jr 152535f3a6 test node current release (10) in addition to node LTS release (8) 2018-09-21 17:22:35 -05:00
Michael Bradley, Jr 90d5657060 simplify appveyor, travis scripts 2018-09-21 17:00:08 -05:00
Michael Bradley, Jr 18239f539b have travis run the tests on osx (macOS) in addition to linux 2018-09-21 11:31:09 -05:00
Michael Bradley, Jr 8e6ed95fdf try bumping appveyor/travis npm version 2018-09-02 20:35:21 -05:00
emizzle 7e2f5624ba Increased time before reporting of library download duration goes red to 4 seconds.
Incrased travis build version to node 8, as embark only supports 8.10, and also perf_hooks requires 8.5
2018-06-06 12:04:30 +10:00
Iuri Matias eb599a479d remove testing node 6 from travis (no longer supported) 2018-04-17 14:48:08 -04:00
Iuri Matias 473ee56522 update travis 2018-03-30 09:11:25 -04:00
Iuri Matias 170143b52c update travis config 2017-12-14 10:12:14 -05:00
Todd Baur a948cecd42 remove old versions of node 2017-03-30 02:46:19 +09:00
Iuri Matias a32fadc107 update code coverage condig 2016-10-22 21:02:11 -04:00
Iuri Matias a12bbb201f add test file 2016-10-22 18:28:08 -04:00