Skip to content
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
11 changes: 11 additions & 0 deletions solidjs-ui-page-sample/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"env": {
"node": true
},
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["n","@servicenow/sdk-app-plugin"],
"extends": ["plugin:@servicenow/sdk-app-plugin/recommended"]
}
7 changes: 7 additions & 0 deletions solidjs-ui-page-sample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
.now/
dist/
node_modules/
target/
*.tsbuildinfo
.jest_cache
5 changes: 5 additions & 0 deletions solidjs-ui-page-sample/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"servicenow.fluent-language-extension"
]
}
6 changes: 6 additions & 0 deletions solidjs-ui-page-sample/now.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"scope": "x_sepa_work2",
"scopeId": "8797724224f147678de446fc6dfedfde",
"name": "work2",
"tsconfigPath": "./src/server/tsconfig.json"
}
75 changes: 75 additions & 0 deletions solidjs-ui-page-sample/now.prebuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import {
servicenowFrontEndPlugins,
rollup,
glob,
} from "@servicenow/isomorphic-rollup";
import babel from "@rollup/plugin-babel";

/**
* Prebuild script for building the client assets of the application before running the rest of the build.
* Export an async function that accepts useful modules for building the application as arguments.
* This function returns a Promise that resolves when the build is complete.
* You can also export an array of functions if you want to run multiple prebuild steps.
*/
export default async ({
rootDir,
config,
fs,
path,
logger,
registerExplicitId,
}) => {
// This is where all the client source files are located
const clientDir = path.join(rootDir, config.clientDir);
const htmlFilePattern = path.join("**", "*.html");
const htmlFiles = await glob(htmlFilePattern, { cwd: clientDir, fs });
if (!htmlFiles.length) {
logger.warn(`No HTML files found in ${clientDir}, skipping UI build.`);
return;
}

// This is the destination for the build output
const staticContentDir = path.join(rootDir, config.staticContentDir);
// Clean up any previous build output
fs.rmSync(staticContentDir, { recursive: true, force: true });

// Call the rollup build
const rollupBundle = await rollup({
// Use the file system module provided by the build environment
fs,
// Search all HTML files in the client directory to find entry points
input: path.join(clientDir, "**", "*.html"),
// Use the default set of ServiceNow plugins for Rollup
// configured for the scope name and root directory
plugins: [
...servicenowFrontEndPlugins({
scope: config.scope,
rootDir: clientDir,
registerExplicitId,
}).filter(({ name }) => name !== "swc"),
babel({
extensions: [".js", ".jsx", ".ts", ".tsx"],
babelHelpers: "bundled",
presets: ["babel-preset-solid", "@babel/preset-typescript"],
}),
],
});
// Write the build output to the configured destination
// including source maps for JavaScript files
const rollupOutput = await rollupBundle.write({
dir: staticContentDir,
sourcemap: true,
});
// Print the build results
rollupOutput.output.forEach((file) => {
if (file.type === "asset") {
logger.info(
`Bundled asset: ${file.fileName} (${file.source.length} bytes)`,
);
} else if (file.type === "chunk") {
logger.info(
`Bundled chunk: ${file.fileName} (${file.code.length} bytes)`,
);
}
});
};
Loading