Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add gaurav9576 scope #9

Open
wants to merge 11 commits into
base: fix_ci
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
text=auto
19 changes: 12 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ jobs:
- name: Yarn Install
run: yarn install --ignore-engines --frozen-lockfile
- name: Run ember-cli-fastboot Tests
run: yarn workspace ember-cli-fastboot test:ember
run: yarn workspace @gaurav9576/ember-cli-fastboot test:ember
- name: Run fastboot Tests
if: ${{ matrix.os != 'windows-latest' }}
run: yarn workspace fastboot test
run: yarn workspace @gaurav9576/fastboot test
- name: Run fastboot-express-middleware Tests
run: yarn workspace fastboot-express-middleware test
run: yarn workspace @gaurav9576/fastboot-express-middleware test
- name: Run fastboot-app-server Tests
run: yarn workspace fastboot-app-server test:mocha
run: yarn workspace @gaurav9576/fastboot-app-server test:mocha

integration-tests:
name: Integration Tests
Expand Down Expand Up @@ -119,15 +119,20 @@ jobs:
uses: volta-cli/action@v4
with:
node-version: ${{ matrix.node-version }}
- name: Update Npm
run: |
volta install npm@8
volta pin npm@8
npm -v
- name: Yarn Install
run: |
yarn install --ignore-engines --frozen-lockfile
- name: Precook node_modules
run: |
yarn workspace ember-cli-fastboot pretest:precook
yarn workspace @gaurav9576/ember-cli-fastboot pretest:precook
- name: Run Mocha Tests
run: |
yarn workspace ember-cli-fastboot test:mocha
yarn workspace @gaurav9576/ember-cli-fastboot test:mocha

try-scenarios:
name: "${{ matrix.ember-try-scenario }} Scenario for ember-cli-fastboot"
Expand Down Expand Up @@ -163,4 +168,4 @@ jobs:
cache: yarn
- run: yarn install --ignore-engines --frozen-lockfile
- name: test
run: yarn workspace ember-cli-fastboot ember try:one ${{ matrix.ember-try-scenario }} --skip-cleanup
run: yarn workspace @gaurav9576/ember-cli-fastboot ember try:one ${{ matrix.ember-try-scenario }} --skip-cleanup
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
},
"scripts": {
"test": "npm-run-all test:*",
"test:ember-cli-fastboot": "yarn workspace ember-cli-fastboot test:ember",
"test:fastboot": "yarn workspace fastboot test",
"test:fastboot-express-middleware": "yarn workspace fastboot-express-middleware test",
"test:fastboot-app-server": "yarn workspace fastboot-app-server test:mocha",
"test:ember-cli-fastboot": "yarn workspace @gaurav9576/ember-cli-fastboot test:ember",
"test:fastboot": "yarn workspace @gaurav9576/fastboot test",
"test:fastboot-express-middleware": "yarn workspace @gaurav9576/fastboot-express-middleware test",
"test:fastboot-app-server": "yarn workspace @gaurav9576/fastboot-app-server test:mocha",
"test:integration": "yarn workspace integration-tests test",
"test:extra": "yarn workspace basic-app test:mocha && yarn workspace custom-fastboot-app test:mocha"
},
Expand All @@ -30,7 +30,8 @@
"release-it-yarn-workspaces": "^2.0.0"
},
"resolutions": {
"fastboot": "4.1.1"
"fastboot": "file:packages/fastboot",
"ember-cli-fastboot": "file:packages/ember-cli-fastboot"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from 'ember-cli-fastboot/instance-initializers/clear-double-boot';
export { default } from '@gaurav9576/ember-cli-fastboot/instance-initializers/clear-double-boot';
2 changes: 1 addition & 1 deletion packages/ember-cli-fastboot/app/locations/none.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from 'ember-cli-fastboot/locations/none';
export { default } from '@gaurav9576/ember-cli-fastboot/locations/none';
2 changes: 1 addition & 1 deletion packages/ember-cli-fastboot/app/services/fastboot.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from 'ember-cli-fastboot/services/fastboot';
export { default } from '@gaurav9576/ember-cli-fastboot/services/fastboot';
6 changes: 4 additions & 2 deletions packages/ember-cli-fastboot/fix-node-modules.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Options:
}

function run(shouldRestore) {
['fastboot', 'fastboot-express-middleware'].forEach((packageName) => {
['@gaurav9576/fastboot', '@gaurav9576/fastboot-express-middleware'].forEach((packageName) => {
const nodeModulesPackageDir = path.join(nodeModulesDir, packageName);
const precookedPackageDir = path.join(precookedDir, packageName);
const workspacesPackageDir = path.resolve(packagesDir, packageName);
const workspacesPackageDir = path.resolve(packagesDir, packageName.substring(packageName.indexOf('/') + 1));
if (fs.existsSync(nodeModulesPackageDir)) {
console.log(chalk.blue(`remove ${nodeModulesPackageDir}`));
fs.removeSync(nodeModulesPackageDir);
Expand All @@ -46,10 +46,12 @@ function run(shouldRestore) {
`symlink ${nodeModulesPackageDir} -> ${workspacesPackageDir}`
)
);
fs.ensureDirSync(path.dirname(nodeModulesPackageDir));
fs.symlinkSync(workspacesPackageDir, nodeModulesPackageDir, 'dir');
console.log(
chalk.green(`symlink ${precookedPackageDir} -> ${workspacesPackageDir}`)
);
fs.ensureDirSync(path.dirname(precookedPackageDir));
fs.symlinkSync(workspacesPackageDir, precookedPackageDir, 'dir');
}
});
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-cli-fastboot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const path = require('path');
const fs = require('fs');

const MergeTrees = require('broccoli-merge-trees');
const FastBootExpressMiddleware = require('fastboot-express-middleware');
const FastBoot = require('fastboot');
const FastBootExpressMiddleware = require('@gaurav9576/fastboot-express-middleware');
const FastBoot = require('@gaurav9576/fastboot');
const chalk = require('chalk');

const fastbootAppBoot = require('./lib/utilities/fastboot-app-boot');
Expand Down
5 changes: 5 additions & 0 deletions packages/ember-cli-fastboot/lib/path/get-path.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const path = require('path');

module.exports = function() {
return path.resolve(__dirname, '../../../../packages/ember-cli-fastboot');
};
19 changes: 19 additions & 0 deletions packages/ember-cli-fastboot/lib/path/set-fastboot-pkg-path.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const scope = '@gaurav9576';
const packageDir = `${__dirname}/../../../../packages`;

module.exports = function setFastbootPkgPath(pkg) {
pkg.dependencies = pkg.dependencies ?? {};
pkg.overrides = pkg.overrides ?? {};
pkg.overrides[`${scope}/fastboot`] = '*';
pkg.overrides[`${scope}/fastboot-express-middleware`] = '*';
[pkg.dependencies, pkg.devDependencies, pkg.overrides].forEach(depList => {
['fastboot', 'ember-cli-fastboot', 'fastboot-express-middleware'].forEach(
depName => {
const dep = `${scope}/${depName}`;
if (dep in depList) {
depList[dep] = `file:${packageDir}/${depName}`;
}
}
);
});
};
8 changes: 4 additions & 4 deletions packages/ember-cli-fastboot/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ember-cli-fastboot",
"name": "@gaurav9576/ember-cli-fastboot",
"version": "4.1.1",
"description": "Server-side rendering for Ember.js apps",
"keywords": [
Expand Down Expand Up @@ -39,8 +39,8 @@
"ember-cli-lodash-subset": "^2.0.1",
"ember-cli-preprocess-registry": "^3.3.0",
"ember-cli-version-checker": "^5.1.2",
"fastboot": "4.1.1",
"fastboot-express-middleware": "4.1.1",
"@gaurav9576/fastboot": "4.1.1",
"@gaurav9576/fastboot-express-middleware": "4.1.1",
"fastboot-transform": "^0.1.3",
"fs-extra": "^10.0.0",
"json-stable-stringify": "^1.0.1",
Expand Down Expand Up @@ -69,7 +69,7 @@
"co": "4.6.0",
"ember-auto-import": "^2.2.1",
"ember-cli": "~4.1.0",
"ember-cli-addon-tests": "^0.11.1",
"ember-cli-addon-tests": "Gaurav0/ember-cli-addon-tests#fix_scope",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^5.7.2",
"ember-cli-inject-live-reload": "^2.1.0",
Expand Down
26 changes: 14 additions & 12 deletions packages/ember-cli-fastboot/test/fastboot-config-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,51 @@
const expect = require('chai').use(require('chai-string')).expect;
const RSVP = require('rsvp');
const request = RSVP.denodeify(require('request'));
const setFastbootPkgPath = require('../lib/path/set-fastboot-pkg-path');

const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;

describe('FastBoot config', function () {
describe('FastBoot config', function() {
this.timeout(400000);

let app;

before(function () {
before(function() {
app = new AddonTestApp();

return app
.create('fastboot-config', {
emberVersion: '~3.28.12',
emberDataVersion: '~3.28.12',
emberDataVersion: '~3.28.12'
})
.then(function () {
app.editPackageJSON((pkg) => {
.then(function() {
app.editPackageJSON(pkg => {
setFastbootPkgPath(pkg);
delete pkg.devDependencies['ember-fetch'];
delete pkg.devDependencies['ember-welcome-page'];
// needed because @ember-data/store does `FastBoot.require('crypto')`
pkg.fastbootDependencies = ['node-fetch', 'crypto'];
});
return app.run('npm', 'install');
})
.then(function () {
.then(function() {
return app.startServer({
command: 'serve',
command: 'serve'
});
});
});

after(function () {
after(function() {
return app.stopServer();
});

it('provides sandbox globals', function () {
it('provides sandbox globals', function() {
return request({
url: 'http://localhost:49741/',
headers: {
Accept: 'text/html',
},
}).then(function (response) {
Accept: 'text/html'
}
}).then(function(response) {
expect(response.statusCode).to.equal(200);
expect(response.headers['content-type']).to.equalIgnoreCase(
'text/html; charset=utf-8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const expect = require('chai').expect;
const RSVP = require('rsvp');
const request = RSVP.denodeify(require('request'));
const setFastbootPkgPath = require('../lib/path/set-fastboot-pkg-path');

const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;

Expand All @@ -21,6 +22,7 @@ describe('FastBootLocation Configuration', function () {
})
.then(function () {
app.editPackageJSON((pkg) => {
setFastbootPkgPath(pkg);
delete pkg.devDependencies['ember-fetch'];
delete pkg.devDependencies['ember-welcome-page'];
// needed because @ember-data/store does `FastBoot.require('crypto')`
Expand Down
2 changes: 2 additions & 0 deletions packages/ember-cli-fastboot/test/fastboot-location-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const expect = require('chai').expect;
const RSVP = require('rsvp');
const request = RSVP.denodeify(require('request'));
const setFastbootPkgPath = require('../lib/path/set-fastboot-pkg-path');

const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;

Expand All @@ -20,6 +21,7 @@ describe('FastBootLocation', function () {
})
.then(function () {
app.editPackageJSON((pkg) => {
setFastbootPkgPath(pkg);
delete pkg.devDependencies['ember-fetch'];
delete pkg.devDependencies['ember-welcome-page'];
// needed because @ember-data/store does `FastBoot.require('crypto')`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var bodyParser = require('body-parser');
var FastBootExpressMiddleware = require('fastboot-express-middleware');
var FastBoot = require('fastboot');
var FastBootExpressMiddleware = require('@gaurav9576/fastboot-express-middleware');
var FastBoot = require('@gaurav9576/fastboot');

module.exports = {
name: 'post-middleware',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "post-middlware",
"ember-addon": {
"after": [
"ember-cli-fastboot"
"@gaurav9576/ember-cli-fastboot"
]
},
"keywords": [
Expand Down
2 changes: 2 additions & 0 deletions packages/ember-cli-fastboot/test/package-json-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const expect = chai.expect;
const fs = require('fs-extra');
const path = require('path');
const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;
const setFastbootPkgPath = require('../lib/path/set-fastboot-pkg-path');

chai.use(require('chai-fs'));

Expand All @@ -23,6 +24,7 @@ describe('generating package.json', function () {
})
.then(function () {
customApp.editPackageJSON((pkg) => {
setFastbootPkgPath(pkg);
delete pkg.devDependencies['ember-fetch'];
delete pkg.devDependencies['ember-welcome-page'];
// needed because @ember-data/store does `FastBoot.require('crypto')`
Expand Down
16 changes: 9 additions & 7 deletions packages/ember-cli-fastboot/test/request-details-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@ const expect = chai.expect;
const RSVP = require('rsvp');
const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;
const request = RSVP.denodeify(require('request'));
const setFastbootPkgPath = require('../lib/path/set-fastboot-pkg-path');

async function injectMiddlewareAddon(app) {
app.editPackageJSON(function (pkg) {
const scope = '@gaurav9576';
pkg.dependencies = pkg.dependencies ?? {};
['fastboot', 'fastboot-express-middleware'].forEach(depName => {
pkg.dependencies[`${scope}/${depName}`] = '*';
});
pkg.devDependencies['body-parser'] =
process.env.npm_package_devDependencies_body_parser;
pkg.dependencies = pkg.dependencies || {};
pkg['ember-addon'] = {
paths: ['lib/post-middleware'],
};
setFastbootPkgPath(pkg);
delete pkg.devDependencies['ember-fetch'];
delete pkg.devDependencies['ember-welcome-page'];
// needed because @ember-data/store does `FastBoot.require('crypto')`
Expand All @@ -24,19 +30,15 @@ async function injectMiddlewareAddon(app) {
await app.run(
'ln',
'-s',
path.resolve(__dirname, '../../fastboot'),
path.resolve(__dirname, '../../@gaurav9576/fastboot'),
path.resolve(app.path, 'node_modules/fastboot')
);
await app.run(
'ln',
'-s',
path.resolve(__dirname, '../../fastboot-express-middleware'),
path.resolve(__dirname, '../../@gaurav9576/fastboot-express-middleware'),
path.resolve(app.path, 'node_modules/fastboot-express-middleware')
);
app.editPackageJSON(function (pkg) {
pkg.dependencies['fastboot'] = '*';
pkg.dependencies['fastboot-express-middleware'] = '*';
});
}

describe('request details', function () {
Expand Down
20 changes: 20 additions & 0 deletions packages/ember-cli-fastboot/test/root-url-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

const expect = require('chai').use(require('chai-string')).expect;
const RSVP = require('rsvp');
const path = require('path');
const request = RSVP.denodeify(require('request'));
const setFastbootPkgPath = require('../lib/path/set-fastboot-pkg-path');
const getPath = require('../lib/path/get-path');
const exec = RSVP.denodeify(require('child_process').exec);

const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;

Expand All @@ -19,15 +23,31 @@ describe('rootUrl acceptance', function () {
emberVersion: '~3.28.12',
emberDataVersion: '~3.28.12',
})
.then(function () {
return exec(`cd ${getPath()} && npm pack`);
})
.then(function () {
app.editPackageJSON((pkg) => {
const scope = '@gaurav9576';
pkg.dependencies = pkg.dependencies ?? {};
['fastboot', 'fastboot-express-middleware'].forEach(depName => {
pkg.dependencies[`${scope}/${depName}`] = '*';
});
setFastbootPkgPath(pkg);
delete pkg.devDependencies['ember-fetch'];
delete pkg.devDependencies['ember-welcome-page'];
// needed because @ember-data/store does `FastBoot.require('crypto')`
pkg.fastbootDependencies = ['node-fetch', 'crypto'];
});
return app.run('npm', 'install');
})
.then(function () {
const file = path.resolve(
getPath(),
'gaurav9576-ember-cli-fastboot-4.1.1.tgz'
);
return app.run('npm', 'install', file);
})
.then(function () {
return app.startServer({
command: 'serve',
Expand Down
Loading