MCPcopy Create free account
hub / github.com/adobe/react-spectrum / build

Function build

scripts/buildBranchAPI.js:48–246  ·  view source on GitHub ↗

* Building this will run the docs builder using the apiCheck pipeline in .parcelrc This will * generate json containing the visible (API/exposed) type definitions for each package This is run * against the current branch by copying the current branch into a temporary directory and building * ther

()

Source from the content-addressed store, hash-verified

46 * there.
47 */
48async function build() {
49 let backupDir = tempy.directory();
50 let archiveDir;
51 if (args.values.githash) {
52 archiveDir = tempy.directory();
53 console.log('checking out archive of', args.values.githash, 'into', archiveDir);
54 await run('sh', ['-c', `git archive ${args.values.githash} | tar -x -C ${archiveDir}`], {
55 stdio: 'inherit'
56 });
57
58 await run('sh', ['-c', `git archive HEAD | tar -x -C ${backupDir}`], {stdio: 'inherit'});
59 }
60 let srcDir = archiveDir ?? path.join(__dirname, '..');
61 let distDir = path.join(__dirname, '..', 'dist', args.values.output ?? 'branch-api');
62 // if we already have a directory with a built dist, remove it so we can write cleanly into it at the end
63 fs.rmSync(distDir, {recursive: true, force: true});
64 // Create a temp directory to build the site in
65 let dir = tempy.directory();
66 console.log(`Building branch api into ${dir}...`);
67
68 // Generate a package.json containing just what we need to build the website
69 let pkg = {
70 name: 'rsp-website',
71 packageManager: 'yarn@4.2.2',
72 version: '0.0.0',
73 private: true,
74 workspaces: [
75 'packages/react-stately',
76 'packages/react-aria',
77 'packages/react-aria-components',
78 'packages/tailwindcss-react-aria-components',
79 'packages/*/*'
80 ],
81 devDependencies: Object.fromEntries(
82 Object.entries(packageJSON.devDependencies).filter(
83 ([name]) =>
84 name.startsWith('@parcel') ||
85 name === 'parcel' ||
86 name === 'patch-package' ||
87 name.startsWith('@spectrum-css') ||
88 name.startsWith('@testing-library') ||
89 name.startsWith('postcss') ||
90 name.startsWith('@adobe') ||
91 name === 'react' ||
92 name === 'react-dom'
93 )
94 ),
95 dependencies: {},
96 resolutions: packageJSON.resolutions,
97 browserslist: packageJSON.browserslist,
98 scripts: {
99 build: 'yarn parcel build packages/@react-spectrum/actiongroup',
100 postinstall: 'patch-package'
101 },
102 '@parcel/resolver-default': {
103 packageExports: true
104 }
105 };

Callers 1

buildBranchAPI.jsFile · 0.70

Calls 4

runFunction · 0.70
filterMethod · 0.65
hasMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected