Skip to content

Commit

Permalink
Merge pull request #1196 from typed-ember/use_prepack_and_postpack
Browse files Browse the repository at this point in the history
Use prepack and postpack instead of prepublishOnly and postpublish
  • Loading branch information
jamescdavis authored Jul 2, 2020
2 parents 53f2b51 + a8086c7 commit 6b97fbd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions ts/blueprints/ember-cli-typescript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ module.exports = {

let pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));

// Really `prepack` and `postpack` would be ideal, but yarn doesn't execute those when publishing
this._addScript(pkg.scripts, 'prepublishOnly', 'ember ts:precompile');
this._addScript(pkg.scripts, 'postpublish', 'ember ts:clean');
// As of https://github.com/yarnpkg/yarn/pull/5712 yarn runs `prepack` and `postpack` when publishing
this._addScript(pkg.scripts, 'prepack', 'ember ts:precompile');
this._addScript(pkg.scripts, 'postpack', 'ember ts:clean');

// avoid being placed in devDependencies
if (pkg.devDependencies[ADDON_NAME]) {
Expand Down
8 changes: 4 additions & 4 deletions ts/tests/blueprints/ember-cli-typescript-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ describe('Acceptance: ember-cli-typescript generator', function () {
expect(pkg).to.exist;

const pkgJson = JSON.parse(pkg.content);
expect(pkgJson.scripts.prepublishOnly).to.be.undefined;
expect(pkgJson.scripts.postpublish).to.be.undefined;
expect(pkgJson.scripts.prepack).to.be.undefined;
expect(pkgJson.scripts.postpack).to.be.undefined;
expect(pkgJson.devDependencies).to.include.all.keys('ember-cli-typescript-blueprints');
expect(pkgJson.devDependencies).to.include.all.keys('ember-data');
expect(pkgJson.devDependencies).to.include.all.keys('@types/ember-data');
Expand Down Expand Up @@ -97,8 +97,8 @@ describe('Acceptance: ember-cli-typescript generator', function () {
expect(pkg).to.exist;

const pkgJson = JSON.parse(pkg.content);
expect(pkgJson.scripts.prepublishOnly).to.equal('ember ts:precompile');
expect(pkgJson.scripts.postpublish).to.equal('ember ts:clean');
expect(pkgJson.scripts.prepack).to.equal('ember ts:precompile');
expect(pkgJson.scripts.postpack).to.equal('ember ts:clean');
expect(pkgJson.dependencies).to.include.all.keys('ember-cli-typescript');
expect(pkgJson.devDependencies).to.not.include.all.keys('ember-cli-typescript');
expect(pkgJson.devDependencies).to.not.have.any.keys('ember-data');
Expand Down

0 comments on commit 6b97fbd

Please sign in to comment.