Skip to content

Commit

Permalink
Merge branch 'master' into rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini authored Oct 24, 2023
2 parents 8ed1add + f5eeb0a commit 486cab9
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/shared/getting-started/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ npx create-nx-workspace@latest

{% link-card title="Single Angular App" type="tutorial" url="/getting-started/tutorials/angular-standalone-tutorial" icon="angular" /%}

{% link-card title="Single Node App" type="tutorial" url="/getting-started/tutorials/node-server-tutorial" icon="node" /%}
{% link-card title="Single Vue App" type="tutorial" url="/getting-started/tutorials/vue-standalone-tutorial" icon="vue" /%}

<!-- {% link-card title="React Monorepo" type="tutorial" url="/getting-started/tutorials/react-standalone-tutorial" icon="reactMono" /%}
Expand All @@ -58,7 +58,7 @@ npx create-nx-workspace@latest
{% cards cols="3" lgCols="8" mdCols="6" smCols="5" moreLink="/showcase/example-repos" %}

{% link-card title="Express" appearance="small" url="/nx-api/express" icon="express" /%}
{% link-card title="Vue" appearance="small" url="/showcase/example-repos/add-vue" icon="vue" /%}
{% link-card title="Vue" appearance="small" url="/nx-api/vue" icon="vue" /%}
{% link-card title="Next" appearance="small" url="/nx-api/next" icon="nextjs" /%}
{% link-card title="Nuxt" appearance="small" url="/showcase/example-repos/add-nuxt" icon="nuxt" /%}
{% link-card title="Nest" appearance="small" url="/nx-api/nest" icon="nestjs" /%}
Expand Down
6 changes: 5 additions & 1 deletion docs/shared/recipes/add-stack/add-vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ The code for this example is available on GitHub:

{% github-repository url="https://github.com/nrwl/nx-recipes/tree/main/vue" /%}

{% callout title="Official Vue Plugin" %}
This recipe does not use the official Vue plugin, so it doesn't use generators or automate updating framework dependencies. Use [`@nx/vue`](/nx-api/vue) to use those features.
{% /callout %}

**Supported Features**

We'll be using an Nx plugin for Vue called [@nx/vite](/nx-api/vite). Although we are using `@nx/vite`, not all dependencies will be able to be automatically updated. So we'll have to update any framework dependencies as needed.
We'll be using an Nx plugin called [@nx/vite](/nx-api/vite). Although we are using `@nx/vite`, not all dependencies will be able to be automatically updated. So we'll have to update any framework dependencies as needed.

{% pill url="/core-features/run-tasks" %}✅ Run Tasks{% /pill %}
{% pill url="/core-features/cache-task-results" %}✅ Cache Task Results{% /pill %}
Expand Down
22 changes: 18 additions & 4 deletions packages/nx/src/native/tests/watcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ describe('watcher', () => {
beforeEach(() => {
temp = new TempFs('watch-dir');
temp.createFilesSync({
'.gitignore': 'node_modules/',
'.nxignore': 'app2/',
'.gitignore': 'node_modules/\n.env.local',
'.nxignore': 'app2/\n!.env.local',
'.env.local': '',
'app1/main.js': '',
'app1/main.css': '',
'app2/main.js': '',
Expand All @@ -20,8 +21,9 @@ describe('watcher', () => {
console.log(`watching ${temp.tempDir}`);
});

afterEach(() => {
watcher.stop();
afterEach(async () => {
await watcher.stop();
watcher = undefined;
temp.cleanup();
});

Expand Down Expand Up @@ -134,6 +136,18 @@ describe('watcher', () => {
temp.createFileSync('boo.txt', '');
});
});

it('should include files that are negated in nxignore but are ignored in gitignore', (done) => {
watcher = new Watcher(temp.tempDir);
watcher.watch((err, paths) => {
expect(paths.some(({ path }) => path === '.env.local')).toBeTruthy();
done();
});

wait().then(() => {
temp.appendFile('.env.local', 'hello');
});
});
});

function wait(timeout = 500) {
Expand Down
12 changes: 9 additions & 3 deletions packages/nx/src/native/watch/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ pub(super) fn get_ignore_files<T: AsRef<str>>(root: T) -> Vec<IgnoreFile> {

let node_folder = PathBuf::from(root).join("node_modules");
walker.filter_entry(move |entry| !entry.path().starts_with(&node_folder));
walker
let mut ignores = walker
.build()
.flatten()
.filter(|result| {
result.path().ends_with(".nxignore") || result.path().ends_with(".gitignore")
})
.map(|result| {
let path: PathBuf = result.path().into();
.map(|result| result.path().into())
.collect::<Vec<PathBuf>>();

ignores.sort();

ignores
.into_iter()
.map(|path| {
let parent: PathBuf = path.parent().unwrap_or(&path).into();
IgnoreFile {
path,
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/native/watch/watch_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub(super) async fn create_runtime(
.map_err(anyhow::Error::from)?;

filter
.add_globs(&additional_globs, Some(&origin.into()))
.add_globs(additional_globs, Some(&origin.into()))
.map_err(anyhow::Error::from)?;

let mut runtime = RuntimeConfig::default();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ function buildAllWorkspaceFiles(
): FileData[] {
performance.mark('get-all-workspace-files:start');
let fileData: FileData[] = Object.values(projectFileMap).flat();

fileData = fileData.concat(globalFiles);
fileData = fileData.concat(globalFiles).sort();
performance.mark('get-all-workspace-files:end');
performance.measure(
'get-all-workspace-files',
Expand Down
12 changes: 12 additions & 0 deletions packages/vite/src/executors/test/vitest.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ async function getSettings(
? options.config // config is expected to be from the workspace root
: findViteConfig(joinPathFragments(context.root, projectRoot));

if (!viteConfigPath) {
throw new Error(
stripIndents`
Unable to load test config from config file ${viteConfigPath}.
Please make sure that vitest is configured correctly,
or use the @nx/vite:vitest generator to configure it for you.
You can read more here: https://nx.dev/nx-api/vite/generators/vitest
`
);
}

const resolvedProjectRoot = resolve(workspaceRoot, projectRoot);
const resolvedViteConfigPath = resolve(
workspaceRoot,
Expand Down
7 changes: 6 additions & 1 deletion packages/vite/src/utils/options-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,13 @@ export function getViteBuildOptions(
const projectRoot =
context.projectsConfigurations.projects[context.projectName].root;

const outputPath = joinPathFragments(
'dist',
projectRoot != '.' ? projectRoot : context.projectName
);

return {
outDir: relative(projectRoot, options.outputPath),
outDir: relative(projectRoot, options.outputPath ?? outputPath),
emptyOutDir: options.emptyOutDir,
reportCompressedSize: true,
cssCodeSplit: options.cssCodeSplit,
Expand Down

0 comments on commit 486cab9

Please sign in to comment.