Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let app = new EmberAddon(defaults, {
// Add options here
});
/*
This build file specifies the options for the dummy test app of this
addon, located in `/tests/dummy`
This build file does *not* influence how the addon or the app using it
behave. You most likely want to be modifying `./index.js` or app's build file
*/
if (process.env.CLASSIC) {
return app.toTree();
}
const Webpack = require('@embroider/webpack').Webpack;
return require('@embroider/compat').compatBuild(app, Webpack);
};
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
if (process.env.CLASSIC) {
return app.toTree();
}
const Webpack = require('@embroider/webpack').Webpack;
return require('@embroider/compat').compatBuild(app, Webpack);
};
module.exports = function(defaults) {
let app = new EmberAddon(defaults, {
// Add options here
});
if (process.env.CLASSIC) {
return app.toTree();
}
const Webpack = require('@embroider/webpack').Webpack;
return require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticComponents: true,
staticHelpers: true,
splitRouteClasses: true,
splitAtRoutes: ['split-me'],
});
};
app.import('vendor/three.js', { outputFile: 'ordered.js' });
app.import('vendor/one.js', { outputFile: 'ordered.js' });
app.import('vendor/prepend/one.js', { prepend: true });
app.import('vendor/prepend/two.js', { prepend: true });
app.import('vendor/prepend/three.js', { prepend: true });
app.import('vendor/prepend/four.js', { prepend: true });
app.import('vendor/prepend/order.js', { prepend: true });
if (process.env.CLASSIC) {
return app.toTree();
}
const Webpack = require('@embroider/webpack').Webpack;
return require('@embroider/compat').compatBuild(app, Webpack);
};
module.exports = function(defaults) {
let app = new EmberApp(defaults, {});
MacrosConfig.shared().setOwnConfig(__filename, {
isClassic: Boolean(process.env.CLASSIC),
});
if (process.env.CLASSIC) {
return app.toTree();
}
const Webpack = require('@embroider/webpack').Webpack;
return require('@embroider/compat').compatBuild(app, Webpack, {
workspaceDir: process.env.WORKSPACE_DIR,
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticComponents: true,
staticHelpers: true,
packageRules: [
{
package: 'static-app',
appModules: {
'components/fancy-box.js': {
dependsOnComponents: ['{{default-title}}'],
},
},
components: {
'{{fancy-box}}': {
acceptsComponentArguments: [{ name: 'titleComponent', becomes: 'this.titleComponentWithDefault' }],
static async build(project: Project, params: Partial) {
MacrosConfig.reset();
let paramsWithDefaults: BuildParams = Object.assign({}, params, defaultParams);
project.writeSync();
let instance;
if (paramsWithDefaults.type === 'addon') {
instance = emberAddon(project.baseDir, params.emberAppOptions);
} else {
instance = emberApp(project.baseDir, params.emberAppOptions);
}
let addons = new Addons(instance, params.embroiderOptions);
let tree;
if (params.stage === 1) {
tree = addons.tree;
} else {
let compatApp = new App(instance, addons, params.embroiderOptions);
tree = compatApp.tree;
}
let builder = new Builder(tree);
let builderPromise = builder.build();
let results = await Promise.all([builderPromise, addons.ready()]);
let basePath = results[1].outputPath;
return new BuildResult(project, basePath, builder);
}
private constructor(private project: Project, public outputPath: string, private builder: Builder) {
static async build(project: Project, params: Partial) {
MacrosConfig.reset();
let paramsWithDefaults: BuildParams = Object.assign({}, params, defaultParams);
project.writeSync();
let instance;
if (paramsWithDefaults.type === 'addon') {
instance = emberAddon(project.baseDir, params.emberAppOptions);
} else {
instance = emberApp(project.baseDir, params.emberAppOptions);
}
let addons = new Addons(instance, params.embroiderOptions);
let tree;
if (params.stage === 1) {
tree = addons.tree;
} else {
let compatApp = new App(instance, addons, params.embroiderOptions);
tree = compatApp.tree;
}
let builder = new Builder(tree);
let builderPromise = builder.build();
let results = await Promise.all([builderPromise, addons.ready()]);
let basePath = results[1].outputPath;
return new BuildResult(project, basePath, builder);
}
private constructor(private project: Project, public outputPath: string, private builder: Builder) {
return (function() {
const Webpack = require('@embroider/webpack').Webpack;
const { join } = require('path');
const { writeFileSync } = require('fs');
return require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticComponents: true,
onOutputPath(outputPath) {
writeFileSync(join(__dirname, '.embroider-app-path'), outputPath, 'utf8');
},
packagerOptions: {
webpackConfig: {
plugins: [new MonacoWebpackPlugin(/*{languages: ['javascript', 'typescript']}*/)],
},
},
packageRules: [
{
package: '@cardstack/core',
appModules: {