This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"typescript": { | |
"ifStatement.useBraces": "preferNone", | |
"newLineKind": "lf", | |
"preferHanging": true, | |
"singleBodyPosition": "nextLine", | |
"useBraces": "preferNone", | |
"bracePosition": "sameLineUnlessHanging", | |
"arrowFunction.useParentheses": "force", | |
"arguments.preferHanging": "always", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the parent element by its class names | |
const parentElement = document.querySelector('.css-1rw37je.eu4oa1w0'); | |
// Check if the parent element exists | |
if (parentElement) { | |
// Get all the child spans of the parent element | |
const childSpans = parentElement.querySelectorAll('span'); | |
// Create an array to store the words | |
const wordsArray = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ~/.noderalis.ts | |
import { ProjectConfiguration } from '@noderalis/core'; | |
import { CleanWebpackPlugin } from 'clean-webpack-plugin'; | |
console.log('Success!!!'); | |
ProjectConfiguration.create({ | |
builds: [ | |
{ | |
entry: async () => ProjectConfiguration.workspace('@noderalis/cli'), // C:\...\noderalis\packages\noderalis-cli\sources\index.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ~/packages/noderalis-core/sources/ProjectConfiguration.ts | |
import { createRequire, createRequireFromPath } from 'module'; | |
require(path.resolve(__dirname, `../../../.pnp.js`)).setup(); | |
const requireAbs = (createRequire || createRequireFromPath)( | |
path.resolve(__dirname, './ProjectConfiguration.js') | |
); | |
async function requireConfig() { | |
const rootDir = await this.findProjectCwd(process.cwd(), true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Cli } from 'clipanion'; | |
import { Readable, Writable } from 'stream'; | |
import { readdirSync } from 'fs'; | |
import { join } from 'path'; | |
export type CommandContext = { | |
cwd: string; | |
quiet: boolean; | |
stdin: Readable; | |
stdout: Writable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/tools/BaseCommand.ts | |
import { Command } from 'clipanion'; | |
import { CommandContext } from '..'; | |
/** | |
* The BaseCommand allows us to add behind-the-scenes functionality, | |
* while also allowing us to now have to add Command<CommandContext> | |
* to every command manually. | |
*/ | |
export abstract class BaseCommand extends Command<CommandContext> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import TsCheckerPlugin from "fork-ts-checker-webpack-plugin"; | |
import { resolve } from "path"; | |
import { Configuration } from "webpack"; | |
import { cpus } from "os"; | |
const PnpPlugin = require("pnp-webpack-plugin"); | |
const isProductionBuild: boolean = process.env.NODE_ENV == "production"; | |
const config: Configuration = { | |
entry: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Configuration } from "webpack"; | |
import { resolve } from "path"; | |
// Unfortunately pnpwp lacks TypeScript typings. | |
const PnpPlugin = require("pnp-webpack-plugin"); | |
const isProductionBuild: boolean = process.env.NODE_ENV == "production"; | |
const config: Configuration = { | |
entry: { | |
app: resolve(__dirname, "path-to-your-file.js"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Configuration } from "webpack"; | |
import { resolve } from "path"; | |
/** Check if we're using development or production. */ | |
const isProductionBuild: boolean = process.env.NODE_ENV == "production"; | |
/** A basic Webpack config, using some TypeScript sytactic sugar. */ | |
const config: Configuration = { | |
// Here we name our entry "app", you can also add others with any non-reserved names. | |
entry: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "webpack-starter", | |
"version": "1.0.0", | |
"private": true, | |
"scripts": { | |
"build": "NODE_ENV=production && yarn _webpack", | |
"start": "node ./dist/file-example.js", | |
"_webpack": "webpack-cli --config ./config/webpack.config.ts" | |
} | |
} |
NewerOlder